package com.action;

import java.util.HashMap;
import java.util.Map;

import com.opensymphony.xwork2.ActionSupport;

public class DynamicAction extends ActionSupport {
	private static final long serialVersionUID = -5942703343216682343L;

	private Object result;

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}
	
	public String getData() {
		long cur = System.currentTimeMillis();
		if (cur % 2 == 0) {
			result = new int[]{1, 2, 3};
		} else {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("total", 3);
			map.put("rows", new int[]{4, 5, 6});
			result = map;			
		}
		
		return SUCCESS;
	}
}
